<?php

if (!defined('BASEPATH'))
    exit('No direct script access allowed');

class Send_Email extends CI_Email {

    function __construct() {
        parent::__construct();
    }

    function sendmail($data) {

        $config['protocol'] = 'smtp';
        $config['smtp_host'] = 'ssl://smtp.gmail.com';
        $config['smtp_port'] = '465';
        $config['smtp_timeout'] = '7';
        $config['smtp_user'] = 'MapCenter.cs@gmail.com'; // địa chỉ gmail
        $config['smtp_pass'] = 'mapcenter2444'; // pass gmail
        $config['charset'] = 'utf-8';
        $config['newline'] = "\r\n";
        $config['mailtype'] = 'html'; // or html
        $config['validation'] = TRUE; // bool whether to validate email or not      
        $this->initialize($config);


        $this->from($data['from_sender'], $data['name_sender']);
        $this->to($data['to_receiver']);
        $this->subject($data['subject_sender']);
        $this->message($data['message']);

        $this->send();
    }

}
